    /*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Algorithms;

import Models.FacebookFriend;
import Models.TwitterFriend;
import net.ricecode.similarity.*;

/**
 *
 * @author Daniel
 */
public class Comparaciones {
    
    /*
    
    * 
    * 
    * 
    * COMPARACIONES DE AMIGOS
    * Valores de respuesta:
    * 0 = No Similares
    * (0,1) = Rango de similitud
    * 1 = Similares
    * 
    
    */
    public static float CompararAmigos(FacebookFriend A,FacebookFriend B)
    {
        return CompararNombres(A.getName(),B.getName());
    }
    
    
    
    
   
    
    /*
     * 
     * 
     * 
     */
    
    public static float CompararNombres(String A,String B)
    {
        SimilarityStrategy strategy = new JaroWinklerStrategy();
        StringSimilarityService service = new StringSimilarityServiceImpl(strategy);
        SimilarityStrategy strategy2 = new DiceCoefficientStrategy();
        StringSimilarityService service2 = new StringSimilarityServiceImpl(strategy2);
        float resultservice = (float) service.score(A, B);
        float resultservice2 = (float) service2.score(A, B);
        return (float) Math.min(resultservice2,(float)(resultservice));
        
    }
    
    
    

}
